﻿using System;

namespace ChatClient
{
    public abstract class Log
    {
        internal static void Init()
        {
            Console.BackgroundColor = ConsoleColor.White;
            Console.Clear();
        }

        public static void Info(string message, params object[] arg)
        {
            LogMessage(ConsoleColor.Blue, " [Info] ", message, arg);
        }

        public static void Warn(string message, params object[] arg)
        {
            LogMessage(ConsoleColor.Yellow, " [Warning] ", message, arg);
        }

        public static void Error(string message, params object[] arg)
        {
            LogMessage(ConsoleColor.Red, " [Error] ", message, arg);
        }

        public static void Severe(string message, params object[] arg)
        {
            LogMessage(ConsoleColor.DarkRed, " [Severe] ", message, arg);
        }

        public static void LogMessage(ConsoleColor color, string prefix, string message, params object[] arg)
        {
            Console.ForegroundColor = ConsoleColor.Black;
            Console.Write(DateTime.Now);
            Console.ForegroundColor = color;
            Console.Write(prefix);
            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.WriteLine(message, arg);
            Console.ResetColor();
            Console.BackgroundColor = ConsoleColor.White;
            Console.ForegroundColor = ConsoleColor.DarkGray;
        }
    }
}